#@layer()


#define css()

#end

#define script()
<script src="#(CPATH)/static/components/echarts/js/echarts.js"></script>

<script>

    // 基于准备好的dom，初始化echarts实例
    var myChart = echarts.init(document.getElementById('main'));


    $(function (){

        $.ajax({
            url:'/admin/form/data/formChartsData/#(formId ??)?field=#(field ??)',
            type: 'get',
            data: {},
            success:function (result){

                var option = {
                    title: {
                        text: '#para("label")'+'图形数据展示',
                        left: 'center'
                    },
                    tooltip: {
                        trigger: 'item',
                        formatter: '{a} <br/> {b} : {d}%'
                    },
                    legend: {
                        orient: 'vertical',
                        left: 'left',
                        data: result
                    },
                    series: [
                        {
                            name:'#para("label")'+"数据",
                            type: 'pie',
                            data:result
                        }
                    ],
                    emphasis: {
                    itemStyle: {
                        shadowBlur: 10,
                            shadowOffsetX: 0,
                            shadowColor: 'rgba(0, 0, 0, 0.5)'
                    }
                }
                };

                let currentIndex = -1;

                //设置图形 高亮
                setInterval(function() {
                    var dataLen = option.series[0].data.length;
                    // 取消之前高亮的图形
                    myChart.dispatchAction({
                        type: 'downplay',
                        seriesIndex: 0,
                        dataIndex: currentIndex
                    });
                    currentIndex = (currentIndex + 1) % dataLen;
                    // 高亮当前图形
                    myChart.dispatchAction({
                        type: 'highlight',
                        seriesIndex: 0,
                        dataIndex: currentIndex
                    });
                    // 显示 tooltip
                    myChart.dispatchAction({
                        type: 'showTip',
                        seriesIndex: 0,
                        dataIndex: currentIndex
                    });
                }, 2000);


                // 使用刚指定的配置项和数据显示图表。
                myChart.setOption(option);

            }

        })



    })



</script>

#end

#define content()

<div id="main" style="width: 800px;height:600px;margin: auto">


</div>

#end